package com.wzh.exception;

import java.util.Currency;

/**
 * @Author zh wang
 * @Create 2025/6/16 15:59
 * @Description 当尝试在不同货币间进行操作时抛出
 */

public class CurrencyMismatchException extends RuntimeException {

    // 错误信息中货币顺序：this.currency, other.currency
    public CurrencyMismatchException(Currency thisCurrency, Currency otherCurrency) {
        super(String.format("Currency mismatch: %s vs %s",
                thisCurrency.getCurrencyCode(),
                otherCurrency.getCurrencyCode()));
    }

    public CurrencyMismatchException(String message) {
        super(message);
    }
}
